#pragma once

#include <iostream>


// The first version
class Fighter
{
protected:
	virtual void effectSelf()
	{}
	virtual void effectEnemy()
	{}
	virtual bool isEableRelease() 
	{
		return true;
	}
private:
	void playEffect()
	{
		std::cout << "播放燃烧技能特效" << std::endl;		// 所有角色放的燃烧技能都是一样的
	}
public:
	Fighter(int life = 1000, int magic = 0, int attack = 200)
		: _life(life), _magic(magic), _attack(attack)
	{}

	virtual ~Fighter()
	{}

	void IsDie()	// 死亡判断条件是一样的，固定不变的
	{
		if (_life <= 0)
			std::cout << "Warrior Died" << std::endl;
	}

	

	void skillBurn()
	{
		if (isEableRelease())
		{
			effectSelf();	// 对自身影响
			effectEnemy();	// 对敌人影响 -- 固定不变
			playEffect();
		}
		else
			std::cout << "燃烧技能释放失败" << std::endl;
	}

protected:
	int _life;
	int _magic;
	int _attack;
};

class F_Warrior : public Fighter
{
private:
	bool isEableRelease() override
	{
		return _life > 300;
	}
	void effectSelf() override
	{
		std::cout << "自身失去300生命值" << std::endl;
		_life -= 300;
	}

	void effectEnemy() override	// 派生类必须重写
	{
		std::cout << "附近敌人每人失去500生命值" << std::endl;
	}

public:
	F_Warrior(int life = 1000, int magic = 0, int attack = 200)
		: Fighter::Fighter(life, magic, attack)	/*初始基类*/
	{}

	~F_Warrior() 
	{}
};

class F_Mage : public Fighter
{
private:
	bool isEableRelease() override
	{
		return _magic >= 100;
	}

	void effectSelf() override
	{
		std::cout << "自身失去100魔法值" << std::endl;
		_magic -= 100;
	}

	void effectEnemy() override	// 派生类必须重写
	{
		std::cout << "附近敌人每人失去650生命值" << std::endl;
	}
public:
	F_Mage(int life = 800, int magic = 200, int attack = 300)
		: Fighter::Fighter(life, magic, attack)	/*初始基类*/
	{}

	~F_Mage()
	{}
	
};

// class Pastor....